//
//  EsNavigationController.m
//  Estate
//
//  Created by heyong on 16/5/25.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "EsNavigationController.h"

@interface EsNavigationController ()

@end

@implementation EsNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
}

//设置navigation样式
+(void)initialize
{
    UINavigationBar *navigationBarAppearance=[UINavigationBar appearance];
    //设置navigatinBar背景颜色
    navigationBarAppearance.barTintColor = [TTTheme defaultManger].defaultColor;
    
    //设置title颜色
    NSDictionary *dic=@{NSForegroundColorAttributeName:[UIColor whiteColor],
                        NSFontAttributeName:[UIFont systemFontOfSize:18.]};
    [navigationBarAppearance setTitleTextAttributes:dic];
    
    // 返回按钮的箭头及导航左右文字颜色
    navigationBarAppearance.tintColor = [UIColor whiteColor];
    // 设置UITextField的光标颜色
    [[UITextField appearance] setTintColor:[UIColor colorWithRed:0.00 green:0.59 blue:0.53 alpha:1.00]];

//    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin, NSIntegerMin)
//                                                         forBarMetrics:UIBarMetricsDefault];
}

//状态栏为白色
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

/** 重写这个方法 拦截所有push进来的控制器。  viewController：即将push进来的控uu制器 */
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
        /** 设置导航条上面的内容 */
//        * 左边的返回按钮 
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStyleDone target:self action:@selector(back)];
    }
    
    [super pushViewController:viewController animated:animated];
    
}

- (void)back{
    [self popViewControllerAnimated:YES];
}


@end
